﻿using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Rescue_of_the_Dwarvenzombies.SceneObjects;
using Rescue_of_the_Dwarvenzombies.SceneObjects.GameObjects.Items;
using Rescue_of_the_Dwarvenzombies.SceneObjects.SceneObjectsHandlers;
using GameLibrary;

namespace Rescue_of_the_Dwarvenzombies.SceneLayers
{
    public class ItemLayer : SceneLayer
    {
        private ItemHandler itemHandler = new ItemHandler();
        public ItemHandler ItemHandler { get { return itemHandler; } }

        /// <summary>
        /// Initializes a new instance of the <see cref="ItemLayer"/> class.
        /// </summary>
        /// <param name="game">The game.</param>
        public ItemLayer(Game game)
            : base(game)
        {
            LayerName = Constant.Layer.Item;
            Child = new ObstacleLayer(game);
            Depth = Constant.ITEM_LAYER_DEPTH;
        }

        /// <summary>
        /// Inits the objects.
        /// </summary>
        protected override void InitObjects()
        {
        }

        /// <summary>
        /// Gets the scene objects.
        /// </summary>
        /// <returns></returns>
        public override List<ISceneObject> GetSceneObjects()
        {
            SceneObjects = itemHandler.GetItems();
            return SceneObjects;
        }

        /// <summary>
        /// Removes the scene object.
        /// </summary>
        /// <param name="sceneObjectToRemove">The scene object to remove.</param>
        public override void RemoveSceneObject(ISceneObject sceneObjectToRemove)
        {
            itemHandler.RemoveItem((Item)sceneObjectToRemove);
        }
    }
}